#include "../comm.h"
class Solution {
public:
    string smallestString(string s) {
        int i = 0;
        // 从前面开始缩小字典序一定更小
        for(; i < s.size(); ++i)
            if(s[i] != 'a')
                break;
        if(i == s.size()){
            s[s.size() - 1] = 'z';
            return s;
        }
        for(; i < s.size(); ++i)
            if(s[i] != 'a')
                --s[i];
            else
                return s;
        return s;
    }
};